<template>
	<view class="content">
		<view class="header-box">
			<view class="banlance-price"><text style="font-size: 36upx; color: #680200;">¥</text> {{blaceMoney.credit2 ? blaceMoney.credit2 : 0.00}}</view>
			<view  class="group-box-row">
				<view class="blance-group-item">
					<view class="title">今日补贴</view>
					<view class="price">￥{{blaceMoney.toady_subsidy | numberEmptyJudge }}</view>
				</view>
				<view class="line"></view>
				<view class="blance-group-item">
					<view class="title">昨日补贴</view>
					<view class="price" >￥{{blaceMoney.yesterday | numberEmptyJudge}}</view>
				</view>
				<view class="line"></view>
				<view class="blance-group-item">
					<view class="title">累计补贴</view>
					<view class="price" >￥{{blaceMoney.total | numberEmptyJudge }}</view>
				</view>
			</view>
			<view class="tixian" @click="junit('/pages/prefile/my-balance/tixian/tixian')">立即提现</view>
		</view>

		<view class="balance-box">
			<view class="balance-tips">
				<view class="balance-name">余额明细</view>
				<view class="loding-box" @click="junit('/pages/prefile/my-balance/balance-list/balance-list')">
					<text class="loding-title">更多</text>
					<image src="../../../static/images/index/loding.png"></image>
				</view>
			</view>
			<view class="balance-list">
				<view class="balance-item" v-for="(item, index) in blaceMoneyList" :key="index">
					<view class="balance-left">
						<view class="balance-status">{{item.service_type_name}}</view>
						<view class="balance-time">{{item.created_at}}</view>
					</view>
					<view class="balance-right">
						{{item.change_money}}
					</view>
				</view>
				<view class="line"></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				blaceMoney: 0,
				blaceMoneyList: [],
			};
		},
		onLoad() {
			this.getUserBlace();
			this.getUserBlaceList();
		},
		methods: {
			junit(url) {
				uni.navigateTo({
					url: url
				})
			},
			// 获取余额
			getUserBlace() {
				this.$http.get('user.getUserBlace').then(res => {
					
					this.blaceMoney = res.data

				})
			},
			// 获取收入支出明细
			getUserBlaceList() {
				this.$http.get('user.getUserBlaceList').then(res => {
					this.blaceMoneyList = res.data.data
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import './my-balance.scss';
</style>
